#include "../include/errors.h"

extern byte codes[0x10000];
extern byte data[0x10000];
extern byte stack[0x10000];
extern byte buffer[0x10000];

extern qword iregs[128];
extern real4 fregs[64];
extern real8 dregs[64];

void throw_error(EMessage error)
{
    std::string type, value;
    iregs[Flag] |= ERROR;
    iregs[Flag] &= (~RUNNING);
    std::cout << "An Error has occured at Code " << error.address << " !\n";
    printf("Error Code: 0x%02x ,Error Message: %s\n", error.code, error.message.c_str());
    std::cout << "Press \'p\' to check values,or press \'q\' to quit.\n";
    while (getchar() != 'q')
    {
        std::cout << "input the type and address to check:";
        std::cin >> type >> value;
        viewer(type.c_str(), value.c_str());
    }
}